<template>
	<view>
		<section title="基本用法" type="line">
			<uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @input="handleToSuggest">
			</uni-search-bar>
		</section>
		<view class="search-suggest-head">
			<view class="search-suggest-list" v-for="(item,index) in suggestList" :key="index" @tap="onSubimt(item.keyword)">
				<view class="search-suggest-item">
					<text class="iconfont iconsearch"></text>
					{{item.keyword}}
				</view>
			</view>
		</view>
		<view class="search-list-head">
			<view class="search-list" >
				
			</view>
		</view>
	</view>
</template>

<script>
	// import search from "../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue"
	import '../../common/iconfont.css'
	import {
		searchHot,
		searchWord,
		searchSuggest
	} from "../../common/api.js"
	export default {
		data() {
			return {
				searchValue: '',
				searchword: [],
				historyList: [],
				suggestList: [],
				searchList: []
			}
		},
		onLoad() {


		},

		methods: {
			handleToSuggest(e) {
				let vlaue = e
				searchSuggest(vlaue).then(res => {
					this.suggestList = res.data.result.allMatch
				})
			},
			onSubimt(inputvalue){
				this. searchValue = inputvalue
			}

		}
	}
</script>

<style>
.search-suggest {
		border-top: 2rpx #e5e5e5 solid;
		padding: 30rpx;
		font-size: 26rpx;
	}

	.search-suggest-title {
		color: #537caa;
		margin-bottom: 40rpx;
	}

	.search-suggest-item {
		color: #666666;
		margin-bottom: 70rpx;
	}

	.search-suggest-item text {
		color: #c2c2c2;
		font-size: 26rpx;
		margin-right: 26rpx;
	}
</style>
